home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_a_d / dyndlg.zip / DYNDLG.C next >
Text File  |  1992-07-21  |  2KB  |  75 lines

  1. //*-------------------------------------------------------------------------
  2. //| Title:
  3. //|     DynDlg.C
  4. //|
  5. //| Contents:
  6. //|     WinMain()
  7. //|     DoMain()
  8. //*-------------------------------------------------------------------------
  9. #include <WINDOWS.H>
  10. #include "DynDlg.H"
  11. #include "INITPROC.H"
  12. #include "WNDPROC.H"
  13.  
  14.  
  15.  
  16. //*-------------------------------------------------------------------------
  17. //| Title:
  18. //|     WinMain
  19. //|
  20. //| Parameters:
  21. //|     hInstance       - Integer which uniquely identifies this instance
  22. //|                         of the application (hInstance > 0)
  23. //|     hPrevInstance   - Integer identifier of a previous instance of the
  24. //|                         application (hPrevInstance == NULL if no
  25. //|                         previous instance exists)
  26. //|     lpszCmdLine     - Long pointer to command line info
  27. //|     nCmdShow        - Integer value specifying how to start app.,
  28. //|                         (Iconic [7] or Normal [1,5])
  29. //*-------------------------------------------------------------------------
  30. int PASCAL WinMain (    HANDLE hInstance,
  31.                         HANDLE hPrevInstance, 
  32.                         LPSTR  lpszCmdLine,
  33.                         int    nCmdShow)
  34. {
  35.     int iResult;
  36.  
  37.     if (InitApplication(hInstance, hPrevInstance))
  38.        if (InitInstance(hInstance, nCmdShow))
  39.            iResult = DoMain();
  40.  
  41.     return iResult;
  42. }
  43.  
  44.  
  45.  
  46. //*------------------------------------------------------------------------
  47. //| Title:
  48. //|     DoMain
  49. //|
  50. //| Parameters:
  51. //|     None
  52. //|
  53. //| Purpose:
  54. //|     This is the main message loop for the application.  It retrieves
  55. //|     messages from the application's message queue, and dispatches
  56. //|     the messages to the appropriate window procedure(s).
  57. //*------------------------------------------------------------------------
  58. int  DoMain(void)
  59. {
  60.     MSG msg;
  61.     
  62.     while (GetMessage(  &msg,     // message structure   
  63.                         NULL,     // handle of window receiving the message
  64.                         NULL,     // lowest message to examine
  65.                         NULL))    // highest message to examine
  66.         {
  67.         TranslateMessage(&msg);   // Translates virtual key codes
  68.         DispatchMessage(&msg);    // Dispatches message to window procedure 
  69.         }
  70.  
  71.     return ((int) msg.wParam);    // Returns the value from PostQuitMessage
  72. }
  73.  
  74.  
  75.